import axios from 'axios'
import { getToken } from '../utils/token'
const requset = axios.create({
  // baseURL: 'http://toutiao-app.itheima.net'
  baseURL: 'http://localhost:8000'
})
requset.interceptors.request.use(
  function (config) {
    if (getToken() !== null) {
      config.headers.Authorization = `Bearer ${getToken().token}`
    }
    return config
  },
  function (error) {
    return Promise.reject(error)
  }
)
export default requset
